package com.qfedu.lc.api.user.service;

import com.qfedu.lc.api.config.OpenFeignConfig;
import com.qfedu.lc.common.param.UserAdd;
import com.qfedu.lc.common.param.UserLogin;
import com.qfedu.lc.common.vo.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * configuration = OpenFeignConfig.class 配置将header中的token 传递到请求RequsetTemplate 中，后续user-server可以从header中得到token
 */
@FeignClient(value = "lc-userserver",configuration = OpenFeignConfig.class)
public interface UserServiceFeign {

    @PostMapping("/user/register")
    public R register(@RequestBody UserAdd userAdd);



    @PostMapping("/user/loginpass")
    public R  loginPass(@RequestBody UserLogin userLogin);

    /**
     * 退出登录
     *  删除token 相关的key
     * @return
     */
    @GetMapping("/user/logout")
    public R logout();


}
